﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ProdList.aspx.cs" Inherits="Manager_ProdList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>产品列表</title>
    <style type="text/css">
        .x-grid3-row-body .expander
        {
            padding-left: 30px;
            padding-top: 5px;
            padding-bottom: 5px;
        }
        .x-grid3-row-body .expander p
        {
            padding-left: 30px;
            padding-top: 5px;
            padding-bottom: 5px;
        }
        .x-grid3-row-body .expander strong
        {
            font-weight: bold;
        }
    </style>

    <script type="text/javascript">
        if (top == window) {
            window.location.href = "../Main.aspx#/ProdAddNew.aspx";
        }

        function openHelloFineUI() {
            var node = {
                attributes: {
                    href: "ProdAddNew.aspx"
                },
                text: "你好 FineUI",
                id: "hello_fineui_example"
            };
            window.parent.addExampleTab(node);
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ext:PageManager ID="PageManager1" runat="server" AjaxLoadingType="mask" AutoSizePanelID="gridList" />
    <ext:Grid ID="gridList" runat="server" AllowPaging="true" PageSize="25" ForceFitAllTime="true"
        EnableRowNumberPaging="true" EmptyText="暂时没有相关数据!" RowNumberWidth="40px" DataKeyNames="pId"
        ShowBorder="false" EnableRowNumber="true" IsDatabasePaging="true" AutoScroll="true"
        ShowHeader="false" EnableCheckBoxSelect="true" OnRowDataBound="gridDataList_RowDataBound"
        OnRowCommand="gridList_RowCommand" OnPageIndexChange="gridList_PageIndexChange">
        <Columns>
            <ext:TemplateField ID="tfExpander" runat="server" RenderAsRowExpander="true">
                <ItemTemplate>
                    <div class="expander">
                        <p>
                            <asp:Image ID="imgProd" runat="server" ImageUrl='<%# Eval("pDefaultImg") %>' Height="60" /></p>
                        <p>
                            <strong>内容简介：</strong><%# Eval("pShortInstr")%></p>
                        <p>
                            <strong>详细内容：</strong><%# HttpUtility.HtmlDecode(Convert.ToString(Eval("pNote")))%></p>
                    </div>
                </ItemTemplate>
            </ext:TemplateField>
            <ext:BoundField ID="bfProdName" runat="server" HeaderText="产品名称" DataField="pName" />
            <ext:BoundField ID="bfProdCode" runat="server" HeaderText="编号" DataField="pCode" />
            <ext:TemplateField ID="tfProdClass" runat="server" HeaderText="类别">
                <ItemTemplate>
                    <asp:Label ID="lblProdClass" runat="server"></asp:Label>
                </ItemTemplate>
            </ext:TemplateField>
            <ext:BoundField ID="bfuPrices" runat="server" HeaderText="会员价" DataField="pUserPrice" />
            <ext:BoundField ID="bfProMarketPrice" runat="server" HeaderText="市场价" DataField="pMarketPrice" />
            <ext:BoundField ID="bfProdHits" runat="server" HeaderText="访问量" DataField="pHits" />
            <ext:CheckBoxField ID="cboxPStatus" runat="server" HeaderText="状态" DataField="pStatus"
                Width="40" TextAlign="center" />
            <ext:CheckBoxField ID="cboxPIsHot" runat="server" HeaderText="热销" DataField="pIsHot"
                Width="40" TextAlign="center" />
            <ext:CheckBoxField ID="cboxPIsNews" runat="server" HeaderText="新品" DataField="pIsNews"
                Width="40" TextAlign="center" />
            <ext:BoundField ID="bfAddTime" runat="server" HeaderText="加入时间" DataField="pAddTime"
                Width="120" />
            <ext:WindowField TextAlign="Center" Width="30px" WindowID="winForm" Icon="basketEdit"
                ToolTip="编辑" DataIFrameUrlFields="pId,pClassId" DataIFrameUrlFormatString="ProdAddNew.aspx?ProdId={0}&Class={1}"
                Title="产品资料编辑" />
            <ext:LinkButtonField ID="lbtnAddColorImg" runat="server" CommandName="InsertColorImg"
                ToolTip="管理产品颜色" Icon="foldercamera" TextAlign="center" Width="30" />
            <ext:LinkButtonField ID="lbtnfDelete" runat="server" CommandName="Delete" ToolTip="删除当前行数据"
                Icon="delete" ConfirmText="是否确定删除当前行数据？" Width="30" TextAlign="center" />
        </Columns>
        <Toolbars>
            <ext:Toolbar ID="Toolbar1" runat="server">
                <Items>
                    <ext:ToolbarText ID="ToolbarText1" runat="server" Text="产品列表">
                    </ext:ToolbarText>
                    <ext:ToolbarFill ID="ToolbarFill1" runat="server">
                    </ext:ToolbarFill>
                    <ext:Label ID="lblSearchTitle" runat="server" Text="快速检索">
                    </ext:Label>
                    <ext:DropDownList ID="ddlSearchClass" runat="server" EnableSimulateTree="true">
                    </ext:DropDownList>
                    <ext:TwinTriggerBox ID="ttboxKeywords" ShowLabel="false" OnTrigger1Click="ttboxKeywords_Trigger1Click"
                        OnTrigger2Click="ttboxKeywords_Trigger2Click" Trigger1Icon="Clear" EmptyText="搜索关键词"
                        Trigger2Icon="Search" runat="server">
                    </ext:TwinTriggerBox>
                    <ext:ToolbarSeparator ID="ToolbarSeparator" runat="server">
                    </ext:ToolbarSeparator>
                    <ext:Button ID="btnProdAdd" runat="server" Text="新增产品" Icon="Add" OnClick="btnProdAdd_Click">
                    </ext:Button>
                    <ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
                    </ext:ToolbarSeparator>
                    <ext:Button ID="btnProdDelete" runat="server" Text="删除选中" Icon="delete" OnClick="btnProdDelete_Click"
                        ConfirmText="是否确定删除？">
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </Toolbars>
        <PageItems>
            <ext:Button ID="btnRefresh" runat="server" Icon="arrowrefresh" OnClick="btnRefresh_Click">
            </ext:Button>
            <ext:ToolbarFill ID="ToolbarFill3" runat="server">
            </ext:ToolbarFill>
            <ext:ToolbarSeparator ID="ToolbarSeparator2" runat="server">
            </ext:ToolbarSeparator>
            <ext:ToolbarText ID="ToolbarText2" runat="server" Text="每页记录数：">
            </ext:ToolbarText>
            <ext:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
                OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
                <ext:ListItem Text="15" Value="15" />
                <ext:ListItem Text="20" Value="20" />
                <ext:ListItem Text="25" Value="25" Selected="true" />
            </ext:DropDownList>
        </PageItems>
    </ext:Grid>
    <ext:Window ID="winForm" runat="server" Hidden="true" Width="1000px" EnableMaximize="true"
        EnableResize="true" CloseAction="hideRefresh" Height="650px" EnableIFrame="true"
        AutoScroll="true">
    </ext:Window>
    <ext:Window ID="winProdImage" runat="server" Title="产品颜色图片管理" EnableCollapse="true"
        Hidden="true" Width="580px" WindowPosition="goldenSection" OnClose="winProdImage_Close"
        CloseAction="HideRefresh">
        <Items>
            <ext:Grid ID="gridImage" runat="server" EnableRowNumber="true" AllowCellEditing="true"
                ShowHeader="false" AutoHeight="true" Height="300px" DataKeyNames="peId" AutoScroll="true"
                OnRowCommand="gridImage_RowCommand">
                <Columns>
                    <ext:RenderField ID="rfColorName" runat="server" HeaderText="颜色名称" DataField="peName"
                        FieldType="string">
                        <Editor>
                            <ext:TextBox ID="txtColorName" runat="server">
                            </ext:TextBox>
                        </Editor>
                    </ext:RenderField>
                    <ext:RenderField ID="rfEnColorName" runat="server" HeaderText="颜色英文名" DataField="peEnName"
                        FieldType="string">
                        <Editor>
                            <ext:TextBox ID="txtEnColorName" runat="server">
                            </ext:TextBox>
                        </Editor>
                    </ext:RenderField>
                    <ext:ImageField ID="ImageField1" runat="server" HeaderText="图片" DataImageUrlField="peValue"
                        ImageHeight="60px" />
                    <ext:BoundField ID="BoundField3" runat="server" HeaderText="排序" DataField="peOrder" />
                    <ext:LinkButtonField ID="lbfSave" runat="server" Icon="ApplicationFormEdit" ConfirmText="确定修改？"
                        CommandName="Modify" TextAlign="center" Width="40" />
                    <ext:LinkButtonField ID="lbfDelete" runat="server" Icon="delete" ConfirmText="确定删除？"
                        CommandName="Delete" TextAlign="center" Width="40" />
                </Columns>
            </ext:Grid>
            <ext:SimpleForm ID="sfImage" runat="server" Title="上传颜色图片" FooterBarAlign="center"
                BodyPadding="5px">
                <Items>
                    <ext:HiddenField ID="hfProdCode" runat="server">
                    </ext:HiddenField>
                    <ext:HiddenField ID="hfProdClassId" runat="server" Height="60px">
                    </ext:HiddenField>
                    <ext:FileUpload ID="fuProdImage1" runat="server" Label="选择颜色图片" Required="true" EmptyText="请选择要上传的图片">
                    </ext:FileUpload>
                    <ext:TextBox ID="txtImageName" runat="server" Label="颜色名称" Required="true" EmptyText="请填写颜色名称">
                    </ext:TextBox>
                    <ext:TextBox ID="txtEnImageName" runat="server" Label="颜色英文名" EmptyText="请填写颜色英文名">
                    </ext:TextBox>
                    <ext:TextBox ID="txtImageOrder" runat="server" Label="颜色排序" Required="true" EmptyText="只能填写数值型"
                        Text="99" Regex="^\d+$">
                    </ext:TextBox>
                </Items>
                <Toolbars>
                    <ext:Toolbar ID="Toolbar2" runat="server" Position="footer">
                        <Items>
                            <ext:Button ID="btnSaveImage" runat="server" Text="确定上传图片" Icon="systemsave" ValidateForms="sfImage"
                                OnClick="btnSaveImage_Click">
                            </ext:Button>
                            <ext:Button ID="btnResetImage" runat="server" Text="重 置" Icon="reload">
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </Toolbars>
            </ext:SimpleForm>
        </Items>
    </ext:Window>
    </form>
</body>
</html>
